import time
from base_camera import BaseCamera
import glob


class Camera(BaseCamera):
    """An emulated camera implementation that streams a repeated sequence of
    files 1.jpg, 2.jpg and 3.jpg at a rate of one frame per second."""
    imgs = [open(f + '.jpg', 'rb').read() for f in ['1', '2', '3']]
    file_list = glob.glob('/home/cc/WORK/ws_matlab/VOC2012_eval/my_input/kittivoc_ori_1_1/kittivoc_test/JPEGImages/*.jpg')
    images = (open(f, 'rb').read() for f in file_list)

    @staticmethod
    def frames():
        while True:
            time.sleep(1)
            # yield Camera.imgs[int(time.time()) % 3]
            yield Camera.images.__next__()
